import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)


import index from "../pages/index.vue";
import login from "../pages/login.vue";
import search from "../pages/search.vue";
import list from "../pages/list.vue";
import detail from "../pages/detail.vue";
import order from "../pages/order.vue";

import home from "../views/home.vue"
import sort from "../views/sort.vue"
import shop from "../views/shop.vue"
import mine from "../views/mine.vue"


const router = new VueRouter({
  routes:[
    {
      path:"/index",
      component:index,
      children:[
        {
          path:"home",
          component:home
        },
        {
          path:"sort",
          component:sort
        },
        {
          path:"shop",
          component:shop
        },
        {
          path:"mine",
          component:mine
        },
        {
          path:"",
          redirect:"home"
        }
        
      ]
    },
    {
      path:"/login",
      component:login
    },
    {
      path:"/search",
      component:search
    },
    {
      path:"/list",
      component:list
    },
    // 动态路由传参
    {
      path:"/detail/:id",
      component:detail
    },
    {
      path:"/order",
      component:order
    },
    {
      path:"*",
      redirect:"/index"
    }
  ]
})

export default router
